package com.itheima.springboottlias.service.impl;

import Pojo.OperateLog;
import Pojo.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import com.itheima.springboottlias.mapper.OperateLogMapper;
import com.itheima.springboottlias.service.LogOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class LogOperationServiceImpl implements LogOperationService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public PageResult page(Map<String,String> map) {
        Integer page =Integer.parseInt(map.get("page")) ;
        Integer pageSize =Integer.parseInt(map.get("pageSize")) ;
        PageHelper.startPage(page,pageSize);
        Page<OperateLog> pageInfo = operateLogMapper.page(map);
        PageResult pageResult=new PageResult(pageInfo.getTotal(),pageInfo.getResult());


        return pageResult;
    }
}
